LiveUser_Admin
[ class tree: LiveUser_Admin ] [ index: LiveUser_Admin ] [ all elements ]

Source for file Application.php

Documentation is available at Application.php

  1. <?php require_once 'index.php'?>
  2. <h3>Application</h3>
  3. <?php
  4. // Add
  5. for ($i = 1; $i < 4; $i++{
  6.     $data = array('application_define_name' => 'APP'.rand());
  7.     $appId $admin->perm->addApplication($data);
  8.  
  9.     if ($appId === false{
  10.         echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  11.         print_r($admin->getErrors());
  12.     else {
  13.         echo 'Created Application id <b>' $appId '</b><br />';
  14.     }
  15. }
  16.  
  17. // Get
  18. $currentApps $admin->perm->getApplications();
  19.  
  20. if ($currentApps === false{
  21.     echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  22.     print_r($admin->getErrors());
  23. else {
  24.     echo 'These are our current applications:';
  25.     Var_Dump::display($currentApps);
  26.     echo '<br />';
  27. }
  28.  
  29. // Set/Get current Application
  30. $id array_rand($currentApps);
  31. $admin->perm->setCurrentApplication($currentApps[$id]['application_id']);
  32. $currentApp $admin->perm->getCurrentApplication();
  33. echo $currentApp.' is our current application now.<br />';
  34.  
  35. // Remove
  36. $id array_rand($currentApps);
  37. $filters = array('application_id' => $currentApps[$id]['application_id']);
  38. $removeApp $admin->perm->removeApplication($filters);
  39.  
  40. if ($removeApp === false{
  41.     echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  42. else {
  43.     echo '<b>App3</b> was removed<br />';
  44.     unset($currentApps[$id]);
  45. }
  46.  
  47. // Update
  48. $id array_rand($currentApps);
  49. $data = array('application_define_name' => 'APP2_' $currentApps[$id]['application_id''updated');
  50. $filters = array('application_id' => $currentApps[$id]['application_id']);
  51. $updateApp $admin->perm->updateApplication($data$filters);
  52.  
  53. if ($updateApp === false{
  54.     echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  55. else {
  56.     echo '<b>App2</b> was updated<br />';
  57.     $params = array('filters' => array('application_id' => $currentApps[$id]['application_id']));
  58.     $result $admin->perm->getApplications($params);
  59.  
  60.     if ($result === false{
  61.         echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  62.     else {
  63.         Var_Dump::display($result);
  64.     }
  65. }
  66.  
  67. // Get
  68. $currentApps $admin->perm->getApplications();
  69.  
  70. if ($currentApps === false{
  71.     echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  72. else {
  73.     echo 'These are our current applications:';
  74.     Var_Dump::display($currentApps);
  75.     echo '<br />';
  76. }
  77. echo '<hr />';

Documentation generated on Mon, 11 Mar 2019 14:00:08 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.